package com.wyb.fastdfs.controller;

import java.io.IOException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.wyb.fastdfs.entity.FileEntity;
import com.wyb.fastdfs.service.FileService;

/**
 * @Author:wangyibo
 * @Date 2021年8月12日
 * @Version:1.0
 * @Description:TODO
 */
@RestController
@RequestMapping("/dbfile")
public class FileController {

	@Autowired
	private FileService fileService;

	// 查询file库所有信息
	@GetMapping("/list")
	public List<FileEntity> fileEntities() {
		return fileService.fileEntities();
	}

	// 验证（上架到es）
	@GetMapping("/verify")
	public boolean verifyFile(@RequestParam("fileId") String fileId) throws IOException {
		return fileService.verify(fileId);
	}

}
